﻿using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using Project.Domain.Entities;
namespace Framework.EntityFramework
{
    public class DomainContext : DbContext
    {
        public DbSet<User> Users { get; set; }
        public DbSet<SecureUser> SecureUsers { get; set; }
        public DbSet<SecurityLog> SecurityLogs { get; set; }
        public DbSet<Deposit> Deposits { get; set; }
        public DbSet<WithDraw> WithDraws { get; set; }
        public DbSet<SoccerTeam> SoccerTeams { get; set; }
        public DbSet<Match> Matches { get; set; }
        public DbSet<Bet> Bets { get; set; }
        public DbSet<BetDetail> BetDetails { get; set; }
        public DbSet<League> Leagues { get; set; }
        public DbSet<UserBet> UserBets { get; set; }
        public DbSet<Content> Contents { get; set; }
        public DbSet<Contact> Contacts { get; set; }
        public DbSet<StoreSecure> StoreSecures { get; set; }
        public DbSet<Country> Countries { get; set; }        
        public DbSet<Common> Commons { get; set; }
        public DbSet<Announcement> Announcements { get; set; }
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();            
            modelBuilder.Entity<Match>().HasRequired(m => m.HomeTeam).WithMany().HasForeignKey(s => s.HomeTeamId);
            modelBuilder.Entity<Match>().HasRequired(m => m.AwayTeam).WithMany().HasForeignKey(s => s.AwayTeamId);                       
        }
    }
}